package es.ibm.santillana.mdm.common.bussinesmodel;

import com.ibm.pim.catalog.item.BaseItem;
import com.ibm.pim.collaboration.CollaborationItem;
import com.ibm.pim.common.exceptions.PIMInvalidOperationException;
import com.ibm.pim.context.PIMContextFactory;
import com.ibm.pim.hierarchy.Hierarchy;
import com.ibm.pim.hierarchy.HierarchyManager;
import com.ibm.pim.hierarchy.category.Category;

import es.ibm.santillana.mdm.common.util.ConstSantillana;

public class WorkflowManagement {

	/**
	 * map the item to the category of the hierarchy passed  
	 * @param String category id
	 * @param String hierarchy name
	 * @param item
	 */
	public static void mapToCategory (String catId, String hierarchyName, CollaborationItem itm) throws PIMInvalidOperationException {
		
		HierarchyManager hiMng = PIMContextFactory.getCurrentContext().getHierarchyManager();
		Hierarchy hierarchy = hiMng.getHierarchy(hierarchyName);
		Category cat = hierarchy.getCategoryByPrimaryKey(catId);
		itm.mapToCategory(cat);
	}
}
